<?
  header("Cache-Control: max-age=3600, must-revalidate");

  $to = $_POST['to'];
  $address = $_POST['user_address'];
  $city = $_POST['user_city']; 
  $state = $_POST['user_state']; 
  $zip  = $_POST['user_zip'];
  $from = "$address, $city, $state $zip";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html;charset=utf-8" />  
<link rel="stylesheet" href="css/style.css" type="text/css" />
  <title>Alcoholics Anonymous</title>
  <script language="javascript" type="text/javascript" src="javascript/site.js"></script>
  <script src="http://maps.google.com/maps?file=api&v=2.x&key=<? echo googleMapKey(); ?>" type="text/javascript"></script>
  <script type="text/javascript"> 
    var map;
    var directionsPanel;
    var directions;

    function initialize() {
      map = new GMap2(document.getElementById("map_canvas"));
      map.enableGoogleBar();
      map.addControl(new GSmallMapControl());
      map.addControl(new GMapTypeControl());

      ////map.setCenter(new GLatLng(42.351505,-71.094455), 15);
      directionsPanel = document.getElementById("route");
      directions = new GDirections(map, directionsPanel);
      directions.load("<? echo $from; ?> to <? echo $to; ?>");

      // needs some work.  see http://code.google.com/apis/maps/documentation/reference.html#GGeoStatusCode
      code = directions.getStatus().code;

      if (code == 620) {
        alert("Error Code: " + code + "\n\nWe have exceeded our allowed number or requests.  Please contact the Atlanta Central Office with details of this message.");
   	window.location = document.referrer;
      }

      if (code == 601) {
        alert("Error Code: " + code + " - Address Incomplete\n\nPlease verify your originating address and try again.");
   	window.location = document.referrer;
      }

      if (code == 602) {
        alert("Error Code: " + code + " - Address Unknown\n\nPlease verify your originating address and try again.");
   	window.location = document.referrer;
      }

      if (code == 603) {
        alert("Error Code: " + code + " - Address Unavailable\n\nPlease verify your originating address and try again.");
   	window.location = document.referrer;
      }
    }
  </script>
</head>

<body onload="initialize()" onunload="GUnload()">

<div class="content">
  <div class="header_right">
    <div class="top_info">
    <div class="top_info_right">
  </div>		
</div>
					
<div class="bar">
  <ul>
  <li><a href="index.php" accesskey="b">Home</a></li>
  <li><a href="calendar.php" accesskey="a">Calendar</a></li>
  <li><a href="store.php" accesskey="a">Store</a></li>
  <li><a href="meetings.php" accesskey="p">Meetings</a></li>
  <li><a href="contact.php" accesskey="g">Contact Us</a></li>
  </ul>
</div>

</div>
  <div class="logo">
  <h1><a href="#" title="Alcoholics Anonymous">Alcoholics <span class="blue">Anonymous</span></a></h1>
  <center><h3>Central Office of Atlanta, Georgia</h3></center>
  </div>
		
  <div>
  <div class="search_field">
  <form method="post" action="meetings.php">
  <p><span class="grey">Find a Meeting:</span> <span class="search"></span>&nbsp;&nbsp; 
  <input type="text" name="terms" id="terms" class="search" value="CITY, ZIP" onClick="clearSimpleSearch();" onBlur="fillSimpleSearch();"/>
  <input type="submit" name="simple" value="Search" class="button" /></p>
  </form>
  </div>
		
  <div class="newsletter">
  <p>&nbsp;</p>
  </div>
  </div>
		
  <div class="subheader">
  </div>
